<template>
  <div>
    <ul class="bigul">
      <li>
        <div><a-button class="buttoncss" @click="batchRelease">批量发布</a-button> <a-button class="buttoncss" @click="batchStop">批量停用</a-button></div>
      </li>
      <li>
        <span>数据资产状态：</span>
        <a-select v-model:value="dataSource.assetsStatus" placeholder="" class="inputcss">
          <a-select-option v-for="(li, index) in selectoption" :key="index" :value="li.value">{{ li.msg }}</a-select-option> </a-select
        >&nbsp;&nbsp;&nbsp;
        <span>中文名称：</span>
        <a-input v-model:value="dataSource.assetsName" class="inputcss"></a-input>&nbsp;&nbsp;&nbsp;
        <span>英文名称：</span>
        <a-input v-model:value="dataSource.assetsEnglish" class="inputcss"></a-input>&nbsp;&nbsp;&nbsp; <a-button class="buttoncss" @click="reset()">重置</a-button>&nbsp;&nbsp;&nbsp;
        <a-button class="buttoncss" @click="search">查询</a-button>
      </li>
      <li style="margin-left: 100px"><a-button class="buttoncss" @click="goaddasset">新增资产表</a-button></li>
    </ul>
  </div>
</template>
<script lang="ts" setup>
  import { mit } from '../../utils/assetMittConfig';
  import { useRouter } from 'vue-router';
  import { accountInfoApi } from '../../api/test/asset';
  const selectoption = ref([
    { value: 2, msg: '已发布' },
    { value: 1, msg: '未发布' },
    { value: 3, msg: '已停用' },
  ]);
  const inputdata = ref('');
  const rounter = useRouter();
  const dataSource = ref({
    assetsEnglish: '',
    assetsName: '',
    assetsStatus: 1,
  });
  let state: any = {};
  //路由跳转
  const goaddasset = () => {
    rounter.push('/home/addass');
  };
  //发布
  const batchRelease = () => {
    mit.emit('batchRelease', 2);
  };
  //停用
  const batchStop = () => {
    mit.emit('batchRelease', 3);
  };

  //搜索
  const search = async () => {
    mit.emit('loadtrue');
    let a = await accountInfoApi(dataSource.value);
    console.log(a);
    mit.emit('serachdata', a.data);
    mit.emit('loadtrue');
  };
  //重置
  const reset = () => {
    mit.emit('reset');
  };
</script>
<style lang="less" scoped>
  .bigul {
    display: flex;

    justify-content: space-evenly;
    height: 100px;
  }

  .bigul > li:nth-child(1) {
    display: flex;
    align-items: flex-end;
  }

  .bigul > li:nth-child(2) {
    display: flex;
    align-items: center;
  }

  .bigul > li:nth-child(3) {
    display: flex;
    align-items: flex-end;
    margin-right: 20px;
  }

  .inputcss {
    width: 120px;
  }

  .buttoncss {
    border-radius: 5px;
  }
</style>
